package com.sline.collection;

import com.sline.bean.Student;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Demo5_Interator {
    public static void main(String[] args) {
        Collection c1 = new ArrayList();
        c1.add(new Student("张三", 23));
        c1.add(new Student("李四", 24));
        c1.add(new Student("王五", 25));
        c1.add(new Student("赵六", 26));

        Iterator it = c1.iterator();
        while (it.hasNext()) {
            Student s = (Student)it.next();
            System.out.println(s.getName() + "..." + s.getAge());
        }
    }
}
